********************************************************************************
***	FIRM ORGANIZATION WITH MULTIPLE ESTABLISHMENTS *****************************
***	Anna Gumpert, Henrike Steimer and Manfred Antoni ***************************
***	Code ***********************************************************************
********************************************************************************

clear
set more off, perm
set linesize 255

cd h:\

adopath ++ "${prog}"
adopath - PERSONAL
adopath - PLUS
adopath - OLDPLACE
adopath - "."

********************************************************************************
*** MAIN PART
********************************************************************************

********************************************************************************
*** SECTION II.C: Descriptive statistics

*	Tables I, II: Descriptive statistics, ME vs SE firms/ME firms, 2012 cross-section
*	Table A.16: Share of ME firms by sector
do "prog/01_desc-cs_descriptives.do"
*	Tables A.17, A.18: Descriptive statistics, ME vs SE firms/ME firms, 2000-2010 data
do "prog/02_desc-p_descriptives.do"

********************************************************************************
*** SECTION III.A: Distance to headquarters decreases location probability

*	Table III: Distance to headquarters correlates negatively with location probability and establishment size
do "prog/03_facts-cs_MElocation_data.do"	//	Fact 1: data preparations 2012 cross-section
do "prog/04_facts-cs_MElocation.do"			//	Fact 1: analysis 2012 cross-section

*	Table B.1: Location probability and establishment size, ME firms, 2000-2010 data
do "prog/05_facts-p_MElocation_data.do"		//	Fact 1: data preparations 2000-2010 data
do "prog/06_facts-p_MElocation.do"			//	Fact 1: analysis 2000-2010 data

********************************************************************************
*** SECTION III.B: Distance to headquarters increases the number of layers

*	Tables IV, V: Distance to headquarters correlates positively with number of managerial layers of ME firms/HQ and establishments
*	Figures I, II: Distance to headquarters correlates positively with number of managerial layers of ME firms/HQ and establishments
*	Tables B.4-B.11 and B.14-B.17
do "prog/07_facts-cs_MEorg_layer-firm_data.do"	//	Fact 2: data preparations cross-section, definition of layers at firm-level
do "prog/08_facts-cs_MEorg_layer-firm.do"		//	Fact 2: analysis cross-section, definition of layers at firm-level

*	Tables B.2-B.3
do "prog/09_facts-cs_MEorg_layer-est_data.do"	//	Fact 2: data preparations cross-section, definition of layers at unit-level
do "prog/10_facts-cs_MEorg_layer-est.do"		//	Fact 2: analysis cross-section, definition of layers at est/HQ-level

*	Tables B.12-B.13
do "prog/11_facts-p_MEorg_layer-firm_data.do"	//	Fact 2: data preparations 2000-2010 data, definition of layers at firm-level
do "prog/12_facts-p_MEorg_layer-firm.do"		//	Fact 2: analysis 2000-2010 data, definition of layers at firm-level

********************************************************************************
*** SECTION III.C: Reorganization of headquarters or establishments

*	Table VI: Transition dynamics of the managerial organization
*	Tables B.19, B.21-B.23
do "prog/13_facts-p_dynMEorg_layer-firm_data.do"	//	Fact 3: data preparations 2000-2010 data, definition of layers at firm-level
do "prog/14_facts-p_dynMEorg_layer-firm.do"			//	Fact 3: analysis, definition of layers at firm-level

*	Table B.18
do "prog/15_facts-p_dynMEorg_SE_data.do"			//	Fact 3: data preparations 2000-2010 data single-establishment firms
do "prog/16_facts-p_dynMEorg_SE.do"					//	Fact 3: analysis, single-establishment firms

*	Table B.20
do "prog/17_facts-p_dynMEorg_layer-est_data.do"		//	Fact 3: data preparations 2000-2010 data, definition of layers at unit-level
do "prog/18_facts-p_dynMEorg_layer-est.do"			//	Fact 3: analysis, definition of layers at unit-level

********************************************************************************
*** SECTION V: Reorganization due to high-speed railway routes

*	Data preparations
*	Table D.2
do "prog/19_train_layer-firm_data.do"					//	High-speed rail: data preparations, definition of layers at firm-level

*	Table VII: Lower travel times affect all units of ME firms
*	Appendix Tables D.3-D.4, D.6-D.11, D.14-D.16, D.18-D.24 
do "prog/20a_train_layer-firm_est-direct.do"			//	High-speed rail: analysis, directly affected establishments
do "prog/20b_train_layer-firm_hq.do"					//	High-speed rail: analysis, headquarters
do "prog/20c_train_layer-firm_est-indirect.do"			//	High-speed rail: analysis, non-directly affected establishments

*	Figure VIII: The effect of the opening of high-speed railway routes
*	Appendix Table D.5
do "prog/21a_train_layer-firm_est-direct_pretrends.do"	//	High-speed rail: event-study design, directly affected establishments
do "prog/21b_train_layer-firm_hq_pretrends.do" 			//	High-speed rail: event-study design, headquarters
do "prog/21c_train_layer-firm_est-indirect_pretrends.do" //	High-speed rail: event-study design, non-directly affected establishments

** Table D.12: Multiple hypothesis testing following Clarke et al. 2020
do "prog/22a_train_layer-firm_est-direct_romanowolf.do"	//	Adjust SE for multiple hypothesis testing
do "prog/22b_train_layer-firm_hq_romanowolf.do"			//	Adjust SE for multiple hypothesis testing
do "prog/22c_train_layer-firm_est-indirect_romanowolf.do" //	Adjust SE for multiple hypothesis testing

** Table D.17 with establishment-level layer definitions
do "prog/23_train_layer-est_data.do"					//	High-speed rail: data preparations, definition of layers at establishment-level
do "prog/24a_train_layer-est_est-direct.do"				//	High-speed rail: analysis, est.-level layer, directly affected establishments
do "prog/24b_train_layer-est_hq.do"						//	High-speed rail: analysis, est.-level layer, headquarters
do "prog/24c_train_layer-est_est-indirect.do"			//	High-speed rail: analysis, est.-level layer, non-directly affected establishments

********************************************************************************
*** APPENDIX A
********************************************************************************

***	Appendix A.4.1: Plausibility of assignment of occupations to layers
**	Tables A.2-A.14, 2000-2010 data
do "prog/25_cmrh-p_replication_firm_data.do"			//	Replication CMRH: data preparation, 2000-2010 panel
do "prog/26_cmrh-p_replication_firm.do"					//	Replication CMRH: tables at firm-level, 2000-2010 panel
**	Tables A.2-A.6, 2012 cross-section
do "prog/27_cmrh-cs_replication_firm_data.do"			//	Replication CMRH: data preparations, 2012 cross-section
do "prog/28_cmrh-cs_replication_firm.do"				//	Replication CMRH: tables at firm-level, 2012 cross-section

*** Appendix A.5.2: ME vs. SE firm organization
**	Table A.20
do "prog/29_fact-p_org_layer-firm_data.do"				// Comparison ME vs SE firms: data preparations, 2000-2010 data
do "prog/30_facts-p_org_layer-firm.do"					// Comparison ME vs SE firms: 2000-2010 data
**	Table A.19
do "prog/31_fact-cs_org_layer-firm_data.do"				// Comparison ME vs SE firms: data preparations, 2012 cross-section
do "prog/32_facts-cs_org_layer-firm.do"					// Comparison ME vs SE firms: 2012 cross-section

*** Appendix A.5.3: Within ME firm evidence
**	Tables A.21, A.23-A.26, 2000-2010 panel
do "prog/33_cmrh-p_replication_est_data.do"				// Replication CMRH at unit-level: data preparation, 2000-2010 panel
do "prog/34_cmrh-p_replication_hq.do"					// Replication CMRH, headquarters, 2000-2010 panel
do "prog/35_cmrh-p_replication_est.do"					// Replication CMRH, establishments, 2000-2010 panel
**	Tables A.27-A.30, 2000-2010 panel
do "prog/36_cmrh-p_replication_est_data_layer-est.do"	// Replication CMRH at unit-level: data preparation, 2000-2010 panel
do "prog/37_cmrh-p_replication_hq_layer-est.do"			// Replication CMRH, headquarters, 2000-2010 panel
do "prog/38_cmrh-p_replication_est_layer-est.do"		// Replication CMRH, establishments, 2000-2010 panel
**	Tables A.21-A.26, 2012 cross-section
do "prog/39_cmrh-cs_replication_est_data.do"			// Replication CMRH at unit-level: data preparation, 2012 cross-section
do "prog/40_cmrh-cs_replication_hq.do"					// Replication CMRH, headquarters, 2012 cross-section 
do "prog/41_cmrh-cs_replication_est.do"					// Replication CMRH, establishments, 2012 cross-section
**	Tables A.27-A.30, 2012 cross-section
do "prog/42_cmrh-cs_replication_est_data_layer-est.do"	// Replication CMRH at unit-level: data preparation, 2012 cross-section
do "prog/43_cmrh-cs_replication_hq_layer-est.do"		// Replication CMRH, headquarters, 2012 cross-section
do "prog/44_cmrh-cs_replication_est_layer-est.do"		// Replication CMRH, establishments, 2012 cross-section

capture log close
